/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package commands;

import java.util.logging.Level;
import java.util.logging.Logger;
import servidorped.Conversation;
import servidorped.ConversationListFactory;
import servidorped.User;

/**
 *
 * @author Micosil
 */
public class refuse implements Command {

    @Override
    public boolean execute(String[] stringlist, User user) {
        Conversation convo = ConversationListFactory.getList().getConversationByID(Integer.parseInt(stringlist[1]));
        if (convo.isInvited(user)){
            user.getUserSender().setToSend("You are no longer invited to conversation " + convo.getID());
            Logger.getGlobal().log(Level.INFO, "User {0} did not join conversation {1}", new Object[]{user.getUserName(), convo.getID()});
            convo.uninvite(user);
            return true;
        }
        return false;
        
    }
    
}
